# 使用队列遍历文件
import os
import collections


def findAllFilesQU(path):
    # 生成队列
    queue = collections.deque()

    # 路劲进栈
    queue.append(path)
    while len(queue) != 0:
        dirPath = queue.popleft()

        filesList = os.listdir(dirPath)

        for fileName in filesList:
            absPath = os.path.join(dirPath, fileName)

            if os.path.isdir(absPath):
                print("这是一个目录" + fileName)
                queue.append(absPath)
            else:
                print("这是一个文件" + fileName)


findAllFilesQU(r"F:\back\python\stu-ptthon-qianfeng")
